package com.lsh.oms.core.dao.other;

import com.lsh.oms.api.model.query.QueryShippingDto;
import com.lsh.oms.core.dao.MyBatisRepository;
import com.lsh.oms.core.model.order.OrderShippingHead;
import com.lsh.oms.core.model.order.OrderShippingHeadWithBLOBs;
import com.lsh.oms.core.service.tool.Criteria;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author peter
 */
@MyBatisRepository
public interface OrderShippingHeadMapper {

    /**
     * 删除
     *
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Long id);

    /**
     * 插入发货单信息
     *
     * @param record
     * @return
     */
    int insertSelective(OrderShippingHeadWithBLOBs record);

    /**
     * 主键查询
     *
     * @param id
     * @return
     */
    OrderShippingHeadWithBLOBs selectByPrimaryKey(Long id);

    /**
     * 修改发货信息
     *
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(OrderShippingHeadWithBLOBs record);

    /**
     *
     * @param record
     * @return
     */
    int updateByShippingOrderId(OrderShippingHeadWithBLOBs record);

    /**
     * @param record
     * @return
     */
    int updateStatusByShippingId(OrderShippingHead record);

    /**
     * @param orderId
     * @return
     */
    OrderShippingHeadWithBLOBs selectByOrderCode(Long orderId);

    /**
     * 修改
     *
     * @param record
     * @return
     */
    int updateOmsExtByShippingId(OrderShippingHead record);

    /**
     * 修改
     *
     * @param record
     * @return
     */
    int updateByTmsId(OrderShippingHeadWithBLOBs record);

    /**
     * 修改
     *
     * @param record
     * @return
     */
    int updateByRouteId(OrderShippingHeadWithBLOBs record);

    /**
     * 查询
     *
     * @param shippingOrderId
     * @return
     */
    OrderShippingHeadWithBLOBs selectByshippingOrderId(Long shippingOrderId);

    /**
     * 查询
     *
     * @param providerId
     * @param limit
     * @return
     */
    List<OrderShippingHead> selectByProviderId(@Param("providerId") String providerId, @Param("limit") Integer limit);

    /**
     * 查询
     *
     * @param orderId
     * @return
     */
    Map<String, Object> findOrderShippingHeadByOrderId(@Param("order_id") Long orderId);

    /**
     * 查询
     *
     * @param criteria
     * @param start
     * @param limit
     * @return
     */
    List<OrderShippingHeadWithBLOBs> findBaseOnCriteria(@Param("criteria") Criteria criteria, @Param("start") long start, @Param("limit") long limit);

    /**
     * 统计
     *
     * @param criteria
     * @return
     */
    Long countBaseOnCriteria(@Param("criteria") Criteria criteria);


    /**
     * 主键查询
     *
     * @param filter
     * @return
     */
    List<OrderShippingHeadWithBLOBs> selectByFilter(QueryShippingDto filter);


    OrderShippingHeadWithBLOBs selectNewByAddressId(Long addressId);
    /**
     * 主键查询
     *
     * @param filter
     * @return
     */
    Long countByFilter(QueryShippingDto filter);
}